
import $Element from "@/core/Element";
import { IViewBud } from "./type/viewBud.interface"
import style from '@/ViewBud/less/grid.less'
export class ViewBud extends $Element {
    constructor() {
        super("<div/>");
    }
}

function renderViewBudElement(viewBudInfo: IViewBud) {
    const viewBud = new $Element("<div/>");
    viewBud.setStyleWithProp("box-sizing", "border-box");
    if (viewBudInfo.className) {
        viewBud.addClassName(viewBudInfo.className);
    }
    for (let key in viewBudInfo.children) {
        viewBud.appendChild(renderViewBudElement(viewBudInfo.children[key]));
    }
    return viewBud;
}

export default function renderViewBud(viewBudInfo: IViewBud) {
    // const container = new $Element(containerSelector);
    console.log(style);
    const viewBud = renderViewBudElement(viewBudInfo);
    return {
        viewBudElement: viewBud,
        appendTo(selector: string) {
            (new $Element(selector)).appendChild(viewBud)
        }
    }
}
